<template>
  <div class="reportFormPage horizontal-border" v-if="show">
    <div class="report-dom horizontal">
      <el-row>
        <el-col :span="5" :offset="19">
          <div class="pageNumBox">
            <span>第</span>
            <span class="placeholder-min text-center">&nbsp;{{ form.page }}&nbsp;</span>
            <span>页，共</span>
            <span class="placeholder-min text-center">&nbsp;{{ form.totalPage }}&nbsp;</span>
            <span>页</span>
          </div>
        </el-col>
      </el-row>
      <div class="topTwoBox">
        <div class="centerName">{{ this.form.baobmc }}</div>
        <div class="codeText">
          <tr v-for="(item, index) in form.baobbhList">
            {{
              item
            }}
          </tr>
        </div>
      </div>
      <div class="threeTopBox">
        <div class="left-border">
          <div class="box-title">检测单位名称：</div>
          <div class>{{ form.jiancdwmc }}</div>
        </div>
        <div class="right-border">
          <span>报告编号：</span>
          <span class="placeholder">{{ form.baogbh }}</span>
        </div>
      </div>
      <!-- .........................1111111111111111111111111111111......................................................... -->
      <div class="table-border">
        <table height="160px" class="top-table">
          <tbody>
            <tr>
              <td height="30" align="center" width="15%">
                <span style="width: 90px; display: inline-block">工程名称</span>
              </td>
              <td width="35%" class="text-center">
                <span>{{ form.gongcmc }}</span>
              </td>
              <td align="center" width="15%">
                <span style="width: 90px; display: inline-block">工程部位/用途</span>
              </td>
              <td width="35%" class="text-center">
                <span>{{ form.gongcbwyt }}</span>
              </td>
            </tr>
            <tr>
              <td height="30" align="center">样品信息</td>
              <td class="specimen-border" colspan="3">
                <span>样品名称：</span>
                <span :class="{ placeholder: !form.yangpmc }">{{ form.yangpmc }}</span>
                <span>；样品编号：</span>
                <span :class="{ 'placeholder-long': !form.yangpbh }">{{ form.yangpbh }}</span>

                <span>；样品数量：</span>
                <span :class="{ placeholder: !form.yangpsl }">{{ form.yangpsl }}</span>
                <span>；样品状态：</span>
                <span :class="{ placeholder: !form.yangpzt }">{{ form.yangpzt }}</span>
                <span>；来样时间：</span>
                <span :class="{ placeholder: !form.yangpsj }">{{ form.yangpsj }}</span>
              </td>
            </tr>
            <tr>
              <td height="25" align="center" width="15%">
                <span style="width: 90px; display: inline-block">试验检测日期</span>
              </td>
               <!-- <td width="35%" class="text-center">{{ form.shiyjcrq }}</td> -->                                            
 <td width="35%" class="text-center">
      <el-input v-model="form.shiyjcrq" />
</td>
              <td align="center" width="15%">
                <span style="width: 90px; display: inline-block">试验条件</span>
              </td>
              <td v-if="isPdf" width="35%">
                温度：
                <span style="display: inline-block; width: 10%">{{ form.shiytjwd }}</span>
                ℃；湿度：
                <span style="display: inline-block; width: 10%">{{ form.shiytjsd }}</span
                >%RH
              </td>
              <td v-else width="35%">
                温度：
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.shiytjwd" class="height100" style="width: 15%" />℃；湿度：
                <el-input :type="isPdf ? 'string' : 'number'" v-model="form.shiytjsd" class="height100" style="width: 15%" />%RH
              </td>
            </tr>
            <tr>
              <td height="40" align="center" width="15%">
                <span style="width: 90px; display: inline-block">检测依据</span>
              </td>
              <td width="35%">
                <span v-if="isPdf">{{ form.jiancyj }}</span>
                <el-input v-else type="textarea" v-model="form.jiancyj" :rows="2" class="mark" @dblclick.native="showBsJiancyjView" readonly />
              </td>
              <td align="center" width="15%">
                <span style="width: 90px; display: inline-block">判定依据</span>
              </td>
              <td width="35%">
                <span v-if="isPdf">{{ form.pandyj }}</span>
                <el-input v-else type="textarea" v-model="form.pandyj" :rows="2" @dblclick.native="showBsJudgeBaseView" @focus="handleFocus('pandyj')" class="mark" />
              </td>
            </tr>
            <tr class="bottom-border">
              <td height="30" align="center">
                <div>主要仪器设备</div>
                <div>名称及编号</div>
              </td>
              <td colspan="3">
                <span v-if="isPdf">{{ form.zhuyyqsbmcjbh }}</span>
                <el-input v-else type="textarea" :rows="2" v-model="form.zhuyyqsbmcjbh" class="height100 width100 mark" @dblclick.native="showBsInstrumentView" readonly></el-input>
              </td>
            </tr>
          </tbody>
        </table>
        <!-- .................................22222222222222222222222222222222............................................... -->
        <table height="300px" class="middle-table">
          <tbody>
            <tr>
              <td colspan="2">委托编号</td>
              <td colspan="3">
                <el-input tabindex="200" v-model="form.detailList[0].weitbh" @keydown.native="handleKeyDown($event, 0, 0)" :ref="'0_0'" />
              </td>
              <td colspan="2">是否泵送混凝土</td>
              <td colspan="2">
                <el-input tabindex="200" v-model="form.detailList[0].shifbs" @keydown.native="handleKeyDown($event, 0, 1)" :ref="'0_1'" />
              </td>
              <td colspan="2">龄期（d）</td>
              <td colspan="2">
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[0].lingq" @keydown.native="handleKeyDown($event, 0, 2)" :ref="'0_2'" />
              </td>
            </tr>
            <tr>
              <td colspan="3" height="25">测区</td>
              <td>1</td>
              <td>2</td>
              <td>3</td>
              <td>4</td>
              <td>5</td>
              <td>6</td>
              <td>7</td>
              <td>8</td>
              <td>9</td>
              <td>10</td>
            </tr>
            <tr>
              <td rowspan="5" width="2%">
                回
                <br />弹 <br />值
              </td>
              <td colspan="2" width="13%">测区平均回弹值Rm</td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[0].ceq1" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[0].ceq2" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[0].ceq3" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[0].ceq4" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[0].ceq5" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[0].ceq6" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[0].ceq7" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[0].ceq8" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[0].ceq9" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[0].ceq10" disabled />
              </td>
            </tr>
            <tr>
              <td colspan="2">角度修正值</td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[1].ceq1" @blur="calculateHuitzPjz(2, 1)"  @keydown.native="handleKeyDown($event, 1, 0)" :ref="'1_0'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[1].ceq2" @blur="calculateHuitzPjz(2, 2)"   @keydown.native="handleKeyDown($event, 1, 1)" :ref="'1_1'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[1].ceq3" @blur="calculateHuitzPjz(2, 3)"   @keydown.native="handleKeyDown($event, 1, 2)" :ref="'1_2'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[1].ceq4" @blur="calculateHuitzPjz(2, 4)"   @keydown.native="handleKeyDown($event, 1, 3)" :ref="'1_3'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[1].ceq5" @blur="calculateHuitzPjz(2, 5)"   @keydown.native="handleKeyDown($event, 1, 4)" :ref="'1_4'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[1].ceq6" @blur="calculateHuitzPjz(2, 6)"   @keydown.native="handleKeyDown($event, 1, 5)" :ref="'1_5'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[1].ceq7" @blur="calculateHuitzPjz(2, 7)"   @keydown.native="handleKeyDown($event, 1, 6)" :ref="'1_6'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[1].ceq8" @blur="calculateHuitzPjz(2, 8)"   @keydown.native="handleKeyDown($event, 1, 7)" :ref="'1_7'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[1].ceq9" @blur="calculateHuitzPjz(2, 9)"   @keydown.native="handleKeyDown($event, 1, 8)" :ref="'1_8'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[1].ceq10" @blur="calculateHuitzPjz(2, 10)"   @keydown.native="handleKeyDown($event, 1, 9)" :ref="'1_9'"/>
              </td>
            </tr>
            <tr>
              <td colspan="2">角度修正后的回弹值</td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[2].ceq1" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[2].ceq2" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[2].ceq3" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[2].ceq4" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[2].ceq5" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[2].ceq6" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[2].ceq7" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[2].ceq8" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[2].ceq9" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[2].ceq10" disabled />
              </td>
            </tr>
            <tr>
              <td colspan="2">浇筑面修正值</td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[3].ceq1" @blur="calculateHuitzPjz(4, 1)"  @keydown.native="handleKeyDown($event, 2, 0)" :ref="'2_0'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[3].ceq2" @blur="calculateHuitzPjz(4, 2)"   @keydown.native="handleKeyDown($event, 2, 1)" :ref="'2_1'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[3].ceq3" @blur="calculateHuitzPjz(4, 3)"   @keydown.native="handleKeyDown($event, 2, 2)" :ref="'2_2'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[3].ceq4" @blur="calculateHuitzPjz(4, 4)"   @keydown.native="handleKeyDown($event, 2, 3)" :ref="'2_3'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[3].ceq5" @blur="calculateHuitzPjz(4, 5)"   @keydown.native="handleKeyDown($event, 2, 4)" :ref="'2_4'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[3].ceq6" @blur="calculateHuitzPjz(4, 6)"   @keydown.native="handleKeyDown($event, 2, 5)" :ref="'2_5'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[3].ceq7" @blur="calculateHuitzPjz(4, 7)"   @keydown.native="handleKeyDown($event, 2, 6)" :ref="'2_6'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[3].ceq8" @blur="calculateHuitzPjz(4, 8)"   @keydown.native="handleKeyDown($event, 2, 7)" :ref="'2_7'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[3].ceq9" @blur="calculateHuitzPjz(4, 9)"   @keydown.native="handleKeyDown($event, 2, 8)" :ref="'2_8'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[3].ceq10" @blur="calculateHuitzPjz(4, 10)"   @keydown.native="handleKeyDown($event, 2, 9)" :ref="'2_9'"/>
              </td>
            </tr>
            <tr>
              <td colspan="2">浇筑面修正后的回弹值</td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[4].ceq1" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[4].ceq2" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[4].ceq3" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[4].ceq4" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[4].ceq5" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[4].ceq6" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[4].ceq7" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[4].ceq8" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[4].ceq9" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[4].ceq10" disabled />
              </td>
            </tr>
            <tr>
              <td colspan="3">平均碳化深度值dm（mm）</td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[5].ceq1" @blur="calculateHuitzPjz(6, 1)"   @keydown.native="handleKeyDown($event, 3, 0)" :ref="'3_0'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[5].ceq2" @blur="calculateHuitzPjz(6, 2)"   @keydown.native="handleKeyDown($event, 3, 1)" :ref="'3_1'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[5].ceq3" @blur="calculateHuitzPjz(6, 3)"   @keydown.native="handleKeyDown($event, 3, 2)" :ref="'3_2'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[5].ceq4" @blur="calculateHuitzPjz(6, 4)"   @keydown.native="handleKeyDown($event, 3, 3)" :ref="'3_3'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[5].ceq5" @blur="calculateHuitzPjz(6, 5)"   @keydown.native="handleKeyDown($event, 3, 4)" :ref="'3_4'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[5].ceq6" @blur="calculateHuitzPjz(6, 6)"   @keydown.native="handleKeyDown($event, 3, 5)" :ref="'3_5'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[5].ceq7" @blur="calculateHuitzPjz(6, 7)"   @keydown.native="handleKeyDown($event, 3, 6)" :ref="'3_6'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[5].ceq8" @blur="calculateHuitzPjz(6, 8)"   @keydown.native="handleKeyDown($event, 3, 7)" :ref="'3_7'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[5].ceq9" @blur="calculateHuitzPjz(6, 9)"   @keydown.native="handleKeyDown($event, 3, 8)" :ref="'3_8'"/>
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[5].ceq10" @blur="calculateHuitzPjz(6, 10)"   @keydown.native="handleKeyDown($event, 3, 9)" :ref="'3_9'"/>
              </td>
            </tr>
            <tr>
              <td colspan="3">测区强度换算值（MPa）</td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[6].ceq1" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[6].ceq2" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[6].ceq3" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[6].ceq4" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[6].ceq5" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[6].ceq6" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[6].ceq7" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[6].ceq8" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[6].ceq9" disabled />
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[6].ceq10" disabled />
              </td>
            </tr>
            <tr>
              <td colspan="3">强度计算（MPa）</td>
              <td>测区数n</td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[0].ceqsn" @blur="clearEmpty('ceqsn')"   @keydown.native="handleKeyDown($event, 4, 0)" :ref="'4_0'"/>
              </td>
              <td>
                测区强度
                <br />换算值的 <br />平均值 <br />（MPa）
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[0].huanszPjz" @blur="clearEmpty('huanszPjz')"  @keydown.native="handleKeyDown($event, 4, 1)" :ref="'4_1'"/>
              </td>
              <td>
                测区强度
                <br />换算值的 <br />标准差 <br />（MPa）
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[0].huanszBzc" @blur="clearEmpty('huanszBzc')"  @keydown.native="handleKeyDown($event, 4, 2)" :ref="'4_2'"/>
              </td>
              <td>
                测区强度
                <br />换算值的 <br />最小值 <br />（MPa）
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[0].huanszZxz" @blur="clearEmpty('huanszZxz')"  @keydown.native="handleKeyDown($event, 4, 3)" :ref="'4_3'"/>
              </td>
              <td>
                构件现龄
                <br />期砼强度 <br />推定值 <br />（MPa）
              </td>
              <td>
                <el-input :type="isPdf ? 'string' : 'number'" tabindex="200" v-model="form.detailList[0].tongqdTdz" @blur="clearEmpty('tongqdTdz')"  @keydown.native="handleKeyDown($event, 4, 4)" :ref="'4_4'"/>
              </td>
            </tr>
          </tbody>
        </table>
        <!-- .....................................................33333333333333333................................................... -->
        <table height="100px" class="bottom-table">
          <tr>
            <td style="border-bottom-width: 1px">
              <span v-if="isPdf" class="textarea-span">{{ form.jiancjl }}</span>
              <el-input v-else type="textarea" :rows="2" v-model="form.jiancjl" @focus="handleFocus('jiancjl')" @dblclick.native="getJcjl()" />
            </td>
          </tr>
          <tr>
            <td>
              <span v-if="isPdf" class="textarea-span">{{ form.fujsm }}</span>
              <el-input v-else type="textarea" :rows="2" v-model="form.fujsm" @focus="handleFocus('fujsm')" />
            </td>
          </tr>
        </table>
      </div>
      <!-- .................................44444444444............................................. -->
      <table height="22px" class="transparent">
        <tbody>
          <tr>
            <td width="10%" align="right">检测：</td>
            <td width="15%" align="left">
              <!-- {{this.form.jiancr}} -->
            </td>
            <td width="10%" align="right">审核：</td>
            <td width="15%" align="left">
              <!-- {{this.form.jilr}} -->
            </td>
            <td width="10%" align="right">批准：</td>
            <td align="left" width="15%">
              <!-- {{this.form.fuhr}} -->
            </td>
            <td width="10%">日期：</td>
            <td align="left" width="15%">
              <div style="display: inline-block; margin-left: 20px">年</div>
              <div style="display: inline-block; margin-left: 20px">月</div>
              <div style="display: inline-block ;margin-left: 20px">日</div>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
    <bs-instrument-view ref="bsInstrumentViewRef" @select="selectInstrument"></bs-instrument-view>
    <bs-jiancyj-view ref="bsJiancyjViewRef" @select="selectJiancyj" :syType="syType"></bs-jiancyj-view>
    <bs-judge-base-view ref="bsJudgeBaseViewRef" @select="selectJudge" :syType="syType"></bs-judge-base-view>
  </div>
</template>

<script>
import decimal from "@/utils/big-decimal";
import Bus from "@/utils/bus";
import { min } from "lodash";
import { handleFocus, emptyConvert, uniqueStr, calculateMeanvalue, calculateStandardDeviation, handleKeyDown } from "@/views/reportForms/utils";
import { getHntjgHntqdhtfbgBsInfo, queryHtfBgJcjl } from "@/api/report_hntjg/hntjg";
import BsInstrumentView from "@/views/dept/bsInstrument/BsInstrumentView.vue";
import BsJiancyjView from "@/views/sycs/bsJiancyj/BsJiancyjView.vue";
import BsJudgeBaseView from "@/views/sycs/bsJudgeBase/BsJudgeBaseView.vue";
import BaQjDetailView from "@/views/sycs/baQjDetail/BaQjDetailView.vue";
import TableLineLogChart from "@/views/reportForms/components/TableLineLogChart.vue";

export default {
  name: "hntqdhtfbg",
  components: {
    BsInstrumentView,
    BsJiancyjView,
    BsJudgeBaseView,
    BaQjDetailView,
    TableLineLogChart
  },
  props: {
    excelId: {
      type: [String, Number],
      default: () => ""
    },
    syType: {
      type: [String, Number],
      default: () => ""
    },
    page: {
      type: Number,
      default: () => 0
    },
    isPdf: {
      type: Boolean,
      default: () => false
    },
    printEmpty: {
      type: Boolean,
      default: () => false
    }
  },
  data() {
    return {
      form: {
        detailList: [],
        baobbhList: []
      },
      show: false
    };
  },

  watch: {
    isPdf(newVal, oldVal) {
      this.form = { ...emptyConvert(this.form, newVal) };
    }
  },
  created() {
    this.init();
  },
  mounted() {
    // 检测依据
    Bus.$on("setHntqdhtfBgJiancyj", (data) => {
      const { jiancyj, jiancyjIds } = data;
      const str = jiancyj + (this.form.jiancyj ? "、" + this.form.jiancyj : "");
      const ids = jiancyjIds + (this.form.jiancyjIds ? "," + this.form.jiancyjIds : "");
      this.form.jiancyj = uniqueStr(str, "、");
      this.form.jiancyjIds = uniqueStr(ids, ",");
    });
    // 主要设备
    Bus.$on("setHntqdhtfBgZhuyyqsbmcjbh", (data) => {
      const { zhuyyqsbmcjbh, shebIds } = data;
      const str = zhuyyqsbmcjbh + (this.form.zhuyyqsbmcjbh ? "、" + this.form.zhuyyqsbmcjbh : "");
      const ids = shebIds + (this.form.shebIds ? "," + this.form.shebIds : "");
      this.form.zhuyyqsbmcjbh = uniqueStr(str, "、");
      this.form.shebIds = uniqueStr(ids, ",");
    });
    // 平均回弹值
    Bus.$on("setHntqdhtfBgHuitzPjz", (data) => {
      data.forEach((item, index) => {
        this.form.detailList[0]["ceq" + (index + 1)] = item;
        this.calculateHuitzPjz(2, index + 1);
      });
      this.calculateCeqsn();
    });
    // 传值碳化深度
    Bus.$on("setHntqdhtfBgTanhsd", (data) => {
      data.forEach((item, index) => {
        this.form.detailList[5]["ceq" + (index + 1)] = item;
        this.calculateHuitzPjz(6, index + 1);
      });
    });
    // 传值试验条件
    Bus.$on("setHntqdhtfBgShiytj", (data) => {
      const { shiytjwd, shiytjsd } = data;
      this.form.shiytjwd = shiytjwd;
      this.form.shiytjsd = shiytjsd;
    });
  },
  beforeDestroy() {
    // 停止监听事件
    Bus.$off("setHntqdhtfBgJiancyj");
    Bus.$off("setHntqdhtfBgZhuyyqsbmcjbh");
    Bus.$off("setHntqdhtfBgHuitzPjz");
    Bus.$off("setHntqdhtfBgTanhsd");
  },
  methods: {
    // 根据报表id获取当前报表信息
    init() {
      this.show = false;
      getHntjgHntqdhtfbgBsInfo(this.excelId || this.$defaultExcelId).then((response) => {
        this.form = response.data;
        this.setInitialValue();
        if (!this.form.detailList || this.form.detailList.length <= 0) {
          this.getDetailList();
        }
        this.show = true;
        if (!this.form.jiancjl) {
          this.form.jiancjl = "检测结论：";
        }
        if (!this.form.fujsm) {
          this.form.fujsm = "附加声明：";
        }
      });
    },
    // 设置初始值
    setInitialValue() {
      if (this.form) {
        this.form.baobmc = this.form.baobmc || "混凝土强度试验检测报告（回弹法）";
        this.form.baobbh = this.form.baobbh || "BGLP02001F";
        this.$set(this.form, "baobbhList", []);
        this.form.baobbhList = ["BGLP02001F"];
      }
    },
    getDetailList() {
      this.$set(this.form, "detailList", []);
      const d1 = {
        detailId: undefined,
        excelId: this.excelId,
        sort: 1,
        weitbh: undefined,
        shifbs: undefined,
        lingq: undefined,
        ceqsn: undefined,
        huanszPjz: undefined,
        huanszBzc: undefined,
        huanszZxz: undefined,
        tongqdTdz: undefined,
        ceq1: undefined,
        ceq2: undefined,
        ceq3: undefined,
        ceq4: undefined,
        ceq5: undefined,
        ceq6: undefined,
        ceq7: undefined,
        ceq8: undefined,
        ceq9: undefined,
        ceq10: undefined
      };
      const d2 = {
        detailId: undefined,
        excelId: this.excelId,
        sort: 2,
        weitbh: undefined,
        shifbs: undefined,
        lingq: undefined,
        ceqsn: undefined,
        huanszPjz: undefined,
        huanszBzc: undefined,
        huanszZxz: undefined,
        tongqdTdz: undefined,
        ceq1: undefined,
        ceq2: undefined,
        ceq3: undefined,
        ceq4: undefined,
        ceq5: undefined,
        ceq6: undefined,
        ceq7: undefined,
        ceq8: undefined,
        ceq9: undefined,
        ceq10: undefined
      };
      const d3 = {
        detailId: undefined,
        excelId: this.excelId,
        sort: 3,
        weitbh: undefined,
        shifbs: undefined,
        lingq: undefined,
        ceqsn: undefined,
        huanszPjz: undefined,
        huanszBzc: undefined,
        huanszZxz: undefined,
        tongqdTdz: undefined,
        ceq1: undefined,
        ceq2: undefined,
        ceq3: undefined,
        ceq4: undefined,
        ceq5: undefined,
        ceq6: undefined,
        ceq7: undefined,
        ceq8: undefined,
        ceq9: undefined,
        ceq10: undefined
      };
      const d4 = {
        detailId: undefined,
        excelId: this.excelId,
        sort: 4,
        weitbh: undefined,
        shifbs: undefined,
        lingq: undefined,
        ceqsn: undefined,
        huanszPjz: undefined,
        huanszBzc: undefined,
        huanszZxz: undefined,
        tongqdTdz: undefined,
        ceq1: undefined,
        ceq2: undefined,
        ceq3: undefined,
        ceq4: undefined,
        ceq5: undefined,
        ceq6: undefined,
        ceq7: undefined,
        ceq8: undefined,
        ceq9: undefined,
        ceq10: undefined
      };
      const d5 = {
        detailId: undefined,
        excelId: this.excelId,
        sort: 5,
        weitbh: undefined,
        shifbs: undefined,
        lingq: undefined,
        ceqsn: undefined,
        huanszPjz: undefined,
        huanszBzc: undefined,
        huanszZxz: undefined,
        tongqdTdz: undefined,
        ceq1: undefined,
        ceq2: undefined,
        ceq3: undefined,
        ceq4: undefined,
        ceq5: undefined,
        ceq6: undefined,
        ceq7: undefined,
        ceq8: undefined,
        ceq9: undefined,
        ceq10: undefined
      };
      const d6 = {
        detailId: undefined,
        excelId: this.excelId,
        sort: 6,
        weitbh: undefined,
        shifbs: undefined,
        lingq: undefined,
        ceqsn: undefined,
        huanszPjz: undefined,
        huanszBzc: undefined,
        huanszZxz: undefined,
        tongqdTdz: undefined,
        ceq1: undefined,
        ceq2: undefined,
        ceq3: undefined,
        ceq4: undefined,
        ceq5: undefined,
        ceq6: undefined,
        ceq7: undefined,
        ceq8: undefined,
        ceq9: undefined,
        ceq10: undefined
      };
      const d7 = {
        detailId: undefined,
        excelId: this.excelId,
        sort: 7,
        weitbh: undefined,
        shifbs: undefined,
        lingq: undefined,
        ceqsn: undefined,
        huanszPjz: undefined,
        huanszBzc: undefined,
        huanszZxz: undefined,
        tongqdTdz: undefined,
        ceq1: undefined,
        ceq2: undefined,
        ceq3: undefined,
        ceq4: undefined,
        ceq5: undefined,
        ceq6: undefined,
        ceq7: undefined,
        ceq8: undefined,
        ceq9: undefined,
        ceq10: undefined
      };
      this.form.detailList.push(d1);
      this.form.detailList.push(d2);
      this.form.detailList.push(d3);
      this.form.detailList.push(d4);
      this.form.detailList.push(d5);
      this.form.detailList.push(d6);
      this.form.detailList.push(d7);
    },
    // 显示检测依据列表
    showBsJiancyjView() {
      this.$refs.bsJiancyjViewRef.init(this.form.jiancyjIds);
    },
    // 检测依据选择
    selectJiancyj(info) {
      this.form.jiancyj = info.label;
      this.form.jiancyjIds = info.ids;
    },
    // 显示判定依据列表
    showBsJudgeBaseView() {
      this.$refs.bsJudgeBaseViewRef.init(this.form.pandyjIds);
    },
    // 判断依据选择
    selectJudge(info) {
      if (!info || !info.label) {
        return;
      }
      if (!this.form.pandyj) {
        this.form.pandyj = info.label;
      } else {
        if (info && info.label) {
          this.form.pandyj += "、" + info.label;
        }
      }
    },
    // 显示仪器列表
    showBsInstrumentView() {
      this.$refs.bsInstrumentViewRef.init(this.form.shebIds);
    },
    // 仪器选择
    selectInstrument(info) {
      this.form.zhuyyqsbmcjbh = info.label;
      this.form.shebIds = info.ids;
    },
    // 计算回弹值 2 10 form.detailList[1].ceq10
    calculateHuitzPjz(index, type) {
      if (index < 2) return;
      const a = this.form.detailList[index - 2]["ceq" + type];
      const b = this.form.detailList[index - 1]["ceq" + type];
      const c = decimal.add(a, b, 1);
      this.form.detailList[index]["ceq" + type] = parseFloat(c) == 0 ? null : c;
      if (!this.form.detailList[index - 2]["ceq" + type]) {
        this.form.detailList[index - 2]["ceq" + type] = null;
      }
      if (!this.form.detailList[index - 1]["ceq" + type]) {
        this.form.detailList[index - 1]["ceq" + type] = null;
      }
      if (index < 6) {
        this.calculateHuitzPjz(index + 2, type);
      } else {
        this.calculateHuanszPjz();
      }
    },

    // 计算数量
    calculateCeqsn() {
      let arr = [];
      for (let i = 1; i <= 10; i++) {
        const item = this.form.detailList[0]["ceq" + i];
        if (item) {
          arr.push(item);
        } else {
          this.form.detailList[0]["ceq" + i] = null;
        }
      }
      this.form.detailList[0].ceqsn = arr.length;
    },
    // 计算测区强度换算值的平均值
    calculateHuanszPjz() {
      let arr = [];
      for (let i = 1; i <= 10; i++) {
        const item = this.form.detailList[6]["ceq" + i];
        if (item && item != 0) {
          arr.push(item);
        } else {
          this.form.detailList[6]["ceq" + i] = null;
        }
      }
      this.form.detailList[0].huanszPjz = calculateMeanvalue(arr, 1);
      this.form.detailList[0].huanszBzc = calculateStandardDeviation(arr, 2);
      this.form.detailList[0].huanszZxz = min(arr);
      // 构件现龄期砼强度推定值（MPa） = huanszPjz - 1.645*huanszBzc
      this.form.detailList[0].tongqdTdz = decimal.subtract(this.form.detailList[0].huanszPjz, decimal.multiply(1.645, this.form.detailList[0].huanszBzc, 10), 1);
    },
    // 设置子表的值为null
    clearEmpty(type) {
      if (!this.form.detailList[0][type]) {
        this.form.detailList[0][type] = null;
      }
    },
    // 获取检测结论
    getJcjl() {
      // const form = JSON.parse(JSON.stringify(this.form));
      // queryHtfBgJcjl(emptyConvert(form)).then((res) => {
      //   const info = res.data;
      //   this.form.jiancjl = info.jiancjl;
      // });
      let jcjl = "检测结论：经检测，";
      jcjl = jcjl + (this.form.yangpmc || "");
      jcjl = jcjl + "的抗压强度符合设计技术要求。";
      this.form.jiancjl = jcjl;
    },
    submitForm() {
      return this.form;
    },
    handleFocus(event) {
      handleFocus(event, this.page, this.form[event]);
    },
    handleKeyDown(event, rowIndex, colIndex) {
      const maxArr = [2, 9, 9, 9, 4];
      const ref = handleKeyDown(event, rowIndex, colIndex, maxArr);
      if (this.$refs[ref]?.length) {
        this.$refs[ref][0].focus();
      } else if (this.$refs[ref]) {
        this.$refs[ref].focus();
      }
    }
  }
};
</script>

<style scoped></style>
